import request from "@/utils/request"

/**
 * 小区列表查询
 * @params _uId = ccdd00opikookjuhyyttvhnnjuuu, page, row
 */
const getCommunityList = (data, params) => {
  return request({
    url: "/getCommunityList",
    method: "post",
    data: data,
    params: params
  })
}

/**
 * 新增楼栋
 * http://192.168.20.109:3000/project/37/interface/api/658
 * @params
 */
const addFloor = (data) => {
  return request({
    url: "/house/floor/addFloor",
    method: "post",
    data: data
  })
}

/**http://192.168.20.109:3000/project/37/interface/api/476
 * 根据小区id查询楼栋单元列表
 * @params communityId   pageSize   pageNum
 * @returns 
 */
const getFloorList = (data) => {
  return request({
    url: "/getFloorList",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/679
 * 删除楼栋
 * @params
 * @returns 
 */
const removeFloor = (data) => {
  return request({
    url: "/house/floor/remove",
    method: "post",
    data: data
  })
}

/**http://192.168.20.109:3000/project/37/interface/api/483
 * 查询房屋列表
 * @params unitId  floorId  communityId  pageSize  pageNum
 * @returns
 */
const getRoomsList = (data, params) => {
  return request({
    url: "/room/list",
    method: "post",
    data: data,
    params: params
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/490
 * 查询房屋详情信息
 * @params roomId
 * @returns
 */
const getRoomDetail = (data) => {
  return request({
    url: "/room/detail",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/672
 * 新增房屋列表
 * @params roomName  unitId  floorId  communityId  houseModel  houseStatus  buildArea
 * @returns
 */
const addRoom = (data) => {
  return request({
    url: "/room/add",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/497
 * 编辑房屋列表
 * @params roomName  unitId  floorId  communityId  houseModel  houseStatus  buildArea
 * @returns
 */
const updateRoomDetail = (data) => {
  return request({
    url: "/room/update",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/504
 * 删除房屋列表
 * @params roomId
 * @returns
 */
const deleteRoom = (data) => {
  return request({
    url: "/room/delete",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/511
 * 解绑房屋人员信息
 * @params roomId  memberId
 * @returns
 */
const unbindingRoom = (data) => {
  return request({
    url: "/room/unbinding",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/707
 * 单元详情
 * @params unitId
 * @returns
 */
const unitDetail = (data) => {
  return request({
    url: "/house/unit/info",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/686
 * 新增单元
 * @params roomId  memberId
 * @returns
 */
const addUnit = (data) => {
  return request({
    url: "/house/unit/add",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/693
 * 删除单元
 * @params unitId
 * @returns
 */
const removeUnit = (data) => {
  return request({
    url: "/house/unit/remove",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/700
 * 删除单元
 * @params unitId
 * @returns
 */
const editUnit = (data) => {
  return request({
    url: "/house/unit/edit",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/1372
 * 房屋人员导入
 * @params unitId
 * @returns
 */
const importRoom = (data) => {
  return request({
    url: "/room/import",
    method: "post",
    data: data
  })
}
/**http://192.168.20.109:3000/project/37/interface/api/1620
 * 房屋人员导入
 * @params unitId
 * @returns
 */
const importTemplateRoom = (data) => {
  return request({
    url: "/room/importTemplate",
    method: "post",
    responseType: 'blob',
    data: data
  })
}


export default {
  getCommunityList,
  addFloor,
  getFloorList,
  removeFloor,
  getRoomsList,
  getRoomDetail,
  addRoom,
  updateRoomDetail,
  deleteRoom,
  unbindingRoom,
  unitDetail,
  addUnit,
  removeUnit,
  editUnit,
  importRoom,
  importTemplateRoom
}